/**
 * File Name	: DFNative.h
 * Location		: /Data/
 * Lib.Name		: Data.a
 * Designer		: OS (21-11-06)
 */

#pragma once

#include "DataField.h"

namespace Core
{
	class DFNULL : public DataField
	{
	public:
		DFNULL();
		~DFNULL();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
	};

	class DFUC : public DataField
	{
	protected:
		unsigned char m_Value;

	public:
		DFUC();
		DFUC(unsigned char p_UC);
		~DFUC();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator unsigned char();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);

		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFSC : public DataField
	{
	protected:
		char m_Value;

	public:
		DFSC();
		DFSC(char p_SC);
		~DFSC();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator char();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFAUC : public DataField
	{
	protected:
		unsigned char m_Value[32];
		unsigned char m_Length;

	public:
		DFAUC(unsigned char p_Length);
		~DFAUC();
		void Reset();
		void ReadRawData(RawData& p_RawData);
		void WriteRawData(RawData& p_RawData);
		unsigned char& operator[](unsigned char p_Index);
		void operator=(std::string p_String);
		operator std::string();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFUS : public DataField
	{
	protected:
		unsigned short m_Value;

	public:
		DFUS();
		DFUS(unsigned short p_US);
		~DFUS();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator unsigned short();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFSS : public DataField
	{
	protected:
		short m_Value;

	public:
		DFSS();
		DFSS(short p_SS);
		~DFSS();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator short();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFU24 : public DataField
	{
	protected:
		ubit m_Value : 24;

	public:
		DFU24();
		DFU24(ubit p_UL);
		~DFU24();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator ubit();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFS24 : public DataField
	{
	protected:
		sbit m_Value : 24;

	public:
		DFS24();
		DFS24(sbit p_UL);
		~DFS24();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator sbit();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFUL : public DataField
	{
	protected:
		unsigned long m_Value;

	public:
		DFUL();
		DFUL(unsigned long p_UL);
		~DFUL();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator unsigned long();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFSL : public DataField
	{
	protected:
		long m_Value;

	public:
		DFSL();
		DFSL(long p_SL);
		~DFSL();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator long();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};

	class DFString : public DataField
	{
	protected:
		std::string m_Value;

	public:
		DFString();
		DFString(std::string p_String);
		~DFString();
		void Reset();
		unsigned short GetLength() const;
		void ReadRawData(Core::RawData& p_Data);
		void WriteRawData(Core::RawData& p_Data);
		operator std::string();
		std::string GetItemByIndex(unsigned char p_Index);
		void SetItemByIndex(unsigned char p_Index, std::string p_String);
		void ReadJSON(Json::Value& pValue);
		void WriteJSON(Json::Value& pValue);
	};
}
